home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / example / adremove.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-05-08  |  3.1 KB  |  116 lines

  1. VERSION 2.00
  2. Begin Form frmPractice 
  3.    Caption         =   "Add, Remove, Clear"
  4.    ClientHeight    =   3225
  5.    ClientLeft      =   1845
  6.    ClientTop       =   1620
  7.    ClientWidth     =   3615
  8.    Height          =   3630
  9.    Left            =   1785
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3225
  12.    ScaleWidth      =   3615
  13.    Top             =   1275
  14.    Width           =   3735
  15.    Begin CommandButton cmdClear 
  16.       Caption         =   "C&lear"
  17.       Height          =   372
  18.       Left            =   2400
  19.       TabIndex        =   8
  20.       Top             =   1560
  21.       Width           =   972
  22.    End
  23.    Begin CommandButton cmdRemove 
  24.       Caption         =   "&Remove"
  25.       Height          =   372
  26.       Left            =   2400
  27.       TabIndex        =   7
  28.       Top             =   960
  29.       Width           =   972
  30.    End
  31.    Begin CommandButton cmdAdd 
  32.       Caption         =   "&Add"
  33.       Height          =   372
  34.       Left            =   2400
  35.       TabIndex        =   6
  36.       Top             =   360
  37.       Width           =   972
  38.    End
  39.    Begin ListBox lstClient 
  40.       Height          =   1560
  41.       Left            =   120
  42.       Sorted          =   -1  'True
  43.       TabIndex        =   5
  44.       Top             =   840
  45.       Width           =   1812
  46.    End
  47.    Begin TextBox txtName 
  48.       Height          =   288
  49.       Left            =   120
  50.       TabIndex        =   1
  51.       Top             =   360
  52.       Width           =   1812
  53.    End
  54.    Begin CommandButton cmdEixt 
  55.       Caption         =   "&Exit"
  56.       Height          =   372
  57.       Left            =   2400
  58.       TabIndex        =   0
  59.       Top             =   2640
  60.       Width           =   972
  61.    End
  62.    Begin Label lblDisplay 
  63.       BorderStyle     =   1  'Fixed Single
  64.       Height          =   252
  65.       Left            =   960
  66.       TabIndex        =   4
  67.       Top             =   2640
  68.       Width           =   732
  69.    End
  70.    Begin Label lblClients 
  71.       Caption         =   "#Clients"
  72.       Height          =   252
  73.       Left            =   120
  74.       TabIndex        =   3
  75.       Top             =   2640
  76.       Width           =   732
  77.    End
  78.    Begin Label lblName 
  79.       Caption         =   "Name to add"
  80.       Height          =   252
  81.       Left            =   120
  82.       TabIndex        =   2
  83.       Top             =   120
  84.       Width           =   1572
  85.    End
  86. Option Explicit
  87. Sub cmdAdd_Click ()
  88. Dim Client As String
  89. If txtName.Text = "" Then
  90.    lblDisplay.Caption = lstClient.ListCount
  91.    Client = txtName.Text
  92.    lstClient.AddItem Client
  93.    txtName.Text = ""
  94.    lblDisplay.Caption = lstClient.ListCount
  95. End If
  96. End Sub
  97. Sub cmdClear_Click ()
  98. lstClient.Clear
  99. lblDisplay.Caption = lstClient.ListCount
  100. End Sub
  101. Sub cmdEixt_Click ()
  102. End Sub
  103. Sub cmdRemove_Click ()
  104. Dim Ind As Integer
  105. Ind = lstClient.ListIndex
  106. If Ind >= 0 Then
  107.    lstClient.RemoveItem Ind
  108.    lblDisplay.Caption = lstClient.ListCount
  109.    Beep
  110. End If
  111. End Sub
  112. Sub Form_Load ()
  113. ' Initialize # of client to 0.
  114.     lblDisplay.Caption = "0"
  115. End Sub
  116.